package com.cty.controller;

import com.cty.service.ImgService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @Auther: cty
 * @Date: 2020/4/11 19:56
 * @Description:
 * @version: 1.0
 */
@Controller
public class ImgController {
    @Resource
    private ImgService imgServiceImpl;

    @RequestMapping("show")
    public String show(Model model){
        model.addAttribute("list", imgServiceImpl.selAll());
        return "forward:/index.jsp";
    }

    @RequestMapping("delete")
    public String delete(int id){
        imgServiceImpl.delById(id);
        return "redirect:show";
    }
}
